home *** CD-ROM | disk | FTP | other *** search
- ;;; gnus-mouse.el - Rick Frankel (rfrankel@us.oracle.com)
- ;;; this file adds emacs-19 mouse support to gnus news reading.
- ;;; in addition it defines a couple of other utility functions for use with
- ;;; gnus news reading, and addes a menu called News
- ;;; to the menu bar in summary and newsgroup modes.
-
- ;;; this file was created for personal use, and is releases AS IS, with no
- ;;; warranty due to some requests seen on the net.
-
- ;;; Basic Usage:
- ;;; In Newsgroup mode:
- ;;; mouse-1 move to line at mouse (no action)
- ;;; mouse-2 select newsgroup at mouse
- ;;; mouse-3 catchup newsgroup at mouse
- ;;; In Summary mode:
- ;;; mouse-1 move to line at mouse (no action)
- ;;; mouse-2 select article at mouse
- ;;; mouse-3 mark article at mouse as read.
- ;;; O save articles with same subject in file
- ;;; M-C catchup-to-here (see below)
-
- ;;; In summary mode try:
- ;;; mouse-1 on article and menu(News) catchup-to-here.
- ;;; this will mark all article from the beginning of the buffer as read
-
- ;;; Bugs:
- ;;; probably many, but the most obvious is that the News menus are sorted in
- ;;; reverse alphabetical order.
-
- (require 'gnus)
-
- (defun gnus-summary-save-same-in-file (filename)
- "Save articles with same subject \(in article # order\) in FILENAME"
- (interactive "FFile: ")
- (setq filename (expand-file-name filename))
- (let ((count 1) (subject (gnus-summary-subject-string)))
- (save-excursion
- (gnus-summary-save-in-file filename)
- (gnus-summary-mark-as-read nil "S")
- (while (and subject
- (gnus-summary-search-forward nil subject))
- (gnus-summary-save-in-file filename)
- (gnus-summary-mark-as-read nil "S")
- (setq count (1+ count)))
- (gnus-summary-expand-window)
- (message "%d articles saved in %s" count filename)))
- )
- (defun gnus-summary-catchup-to-here ()
- "Mark articles from beginning of current summary buffer to point as read."
- (interactive)
- (beginning-of-line)
- (let ((current (gnus-summary-article-number)))
- (beginning-of-buffer)
- (while (not (= (gnus-summary-article-number) current))
- (gnus-summary-mark-as-read)
- (gnus-summary-next-subject 1)
- )))
- (define-key gnus-summary-mode-map "O" 'gnus-summary-save-same-in-file)
- (define-key gnus-summary-mode-map "\ec" 'gnus-summary-catchup-to-here)
- (defun gnus-set-menus ()
- ;;
- ;; first the group mode menu
- ;;
- (define-key gnus-group-mode-map [menu-bar newsgroup]
- (cons "News" (make-sparse-keymap "newsgroup")))
- (define-key gnus-group-mode-map [menu-bar newsgroup catchup]
- '("catchup" . gnus-group-catchup))
- (define-key gnus-group-mode-map [menu-bar newsgroup edit-global-kill]
- '("edit-global-kill" . gnus-group-edit-global-kill))
- (define-key gnus-group-mode-map [menu-bar newsgroup exit]
- '("exit" . gnus-group-exit))
- (define-key gnus-group-mode-map [menu-bar newsgroup force-update]
- '("force-update" . gnus-group-force-update))
- (define-key gnus-group-mode-map [menu-bar newsgroup get-new-news]
- '("get-new-news" . gnus-group-get-new-news))
- (define-key gnus-group-mode-map [menu-bar newsgroup group-name]
- '("group-name" . gnus-group-group-name))
- (define-key gnus-group-mode-map [menu-bar newsgroup jump-to-group]
- '("jump-to-group" . gnus-group-jump-to-group))
- (define-key gnus-group-mode-map [menu-bar newsgroup kill-group]
- '("kill-group" . gnus-group-kill-group))
- (define-key gnus-group-mode-map [menu-bar newsgroup kill-region]
- '("kill-region" . gnus-group-kill-region))
- (define-key gnus-group-mode-map [menu-bar newsgroup list-all-groups]
- '("list-all-groups" . gnus-group-list-all-groups))
- (define-key gnus-group-mode-map [menu-bar newsgroup list-groups]
- '("list-groups" . gnus-group-list-groups))
- (define-key gnus-group-mode-map [menu-bar newsgroup quit]
- '("quit" . gnus-group-quit))
- (define-key gnus-group-mode-map [menu-bar newsgroup restart]
- '("restart" . gnus-group-restart))
- (define-key gnus-group-mode-map [menu-bar newsgroup suspend]
- '("suspend" . gnus-group-suspend))
- (define-key gnus-group-mode-map [menu-bar newsgroup unsub-current-group]
- '("unsubscribe-current-group" . gnus-group-unsubscribe-current-group))
- (define-key gnus-group-mode-map [menu-bar newsgroup yank-group]
- '("yank-group" . gnus-group-yank-group))
- ;;
- ;; summary mode map additions
- ;;
- (define-key gnus-summary-mode-map [menu-bar summary]
- (cons "News" (make-sparse-keymap "news")))
- (define-key gnus-summary-mode-map [menu-bar summary caesar-message]
- '("caesar-message" . gnus-summary-caesar-message))
- (define-key gnus-summary-mode-map [menu-bar summary cancel-article]
- '("cancel-article" . gnus-summary-cancel-article))
- (define-key gnus-summary-mode-map [menu-bar summary catchup-and-exit]
- '("catchup-and-exit" . gnus-summary-catchup-and-exit))
- (define-key gnus-summary-mode-map [menu-bar summary catchup-to-here]
- '("catchup-to-here" . gnus-summary-catchup-to-here))
- (define-key gnus-summary-mode-map [menu-bar summary clear-mark-backward]
- '("clear-mark-backward" . gnus-summary-clear-mark-backward))
- (define-key gnus-summary-mode-map [menu-bar summary clear-mark-forward]
- '("clear-mark-forward" . gnus-summary-clear-mark-forward))
- (define-key gnus-summary-mode-map [menu-bar summary delete-marked-as-read]
- '("delete-marked-as-read" . gnus-summary-delete-marked-as-read))
- (define-key gnus-summary-mode-map [menu-bar summary delete-marked-with]
- '("delete-marked-with" . gnus-summary-delete-marked-with))
- (define-key gnus-summary-mode-map [menu-bar summary down-thread]
- '("down-thread" . gnus-summary-down-thread))
- (define-key gnus-summary-mode-map [menu-bar summary edit-local-kill]
- '("edit-local-kill" . gnus-summary-edit-local-kill))
- (define-key gnus-summary-mode-map [menu-bar summary exit]
- '("exit" . gnus-summary-exit))
- (define-key gnus-summary-mode-map [menu-bar summary first-unread-article]
- '("first-unread-article" . gnus-summary-first-unread-article))
- (define-key gnus-summary-mode-map [menu-bar summary followup]
- '("followup" . gnus-summary-followup))
- (define-key gnus-summary-mode-map [menu-bar summary followup-with-original]
- '("followup-with-original" . gnus-summary-followup-with-original))
- (define-key gnus-summary-mode-map [menu-bar summary hide-all-threads]
- '("hide-all-threads" . gnus-summary-hide-all-threads))
- (define-key gnus-summary-mode-map [menu-bar summary hide-thread]
- '("hide-thread" . gnus-summary-hide-thread))
- (define-key gnus-summary-mode-map [menu-bar summary kill-same-subject]
- '("kill-same-subject" . gnus-summary-kill-same-subject))
- (define-key gnus-summary-mode-map [menu-bar summary kill-thread]
- '("kill-thread" . gnus-summary-kill-thread))
- (define-key gnus-summary-mode-map [menu-bar summary mark-as-read]
- '("mark-as-read" . gnus-summary-mark-as-read))
- (define-key gnus-summary-mode-map [menu-bar summary mark-as-unread]
- '("mark-as-unread" . gnus-summary-mark-as-unread-forward))
- (define-key gnus-summary-mode-map [menu-bar summary next-group]
- '("next-group" . gnus-summary-next-group))
- (define-key gnus-summary-mode-map [menu-bar summary next-thread]
- '("next-thread" . gnus-summary-next-thread))
- (define-key gnus-summary-mode-map [menu-bar summary next-unread-article]
- '("next-unread-article" . gnus-summary-next-unread-article))
- (define-key gnus-summary-mode-map [menu-bar summary next-unread-same-subject]
- '("next-unread-same-subject" . gnus-summary-next-unread-same-subject))
- (define-key gnus-summary-mode-map [menu-bar summary prev-group]
- '("prev-group" . gnus-summary-prev-group))
- (define-key gnus-summary-mode-map [menu-bar summary prev-same-subject]
- '("prev-same-subject" . gnus-summary-prev-same-subject))
- (define-key gnus-summary-mode-map [menu-bar summary quit]
- '("quit" . gnus-summary-quit))
- (define-key gnus-summary-mode-map [menu-bar summary reply]
- '("reply" . gnus-summary-reply))
- (define-key gnus-summary-mode-map [menu-bar summary reply-with-original]
- '("reply-with-original" . gnus-summary-reply-with-original))
- (define-key gnus-summary-mode-map [menu-bar summary save-article]
- '("save-article" . gnus-summary-save-article))
- (define-key gnus-summary-mode-map [menu-bar summary save-in-file]
- '("save-in-file" . gnus-summary-save-in-file))
- (define-key gnus-summary-mode-map [menu-bar summary save-same-in-file]
- '("save-same-in-file" . gnus-summary-save-same-in-file))
- (define-key gnus-summary-mode-map [menu-bar summary show-all-headers]
- '("show-all-headers" . gnus-summary-show-all-headers))
- (define-key gnus-summary-mode-map [menu-bar summary show-all-threads]
- '("show-all-threads" . gnus-summary-show-all-threads))
- (define-key gnus-summary-mode-map [menu-bar summary show-article]
- '("show-article" . gnus-summary-show-article))
- (define-key gnus-summary-mode-map [menu-bar summary show-thread]
- '("show-thread" . gnus-summary-show-thread))
- (define-key gnus-summary-mode-map [menu-bar summary sort-by-author]
- '("sort-by-author" . gnus-summary-sort-by-author))
- (define-key gnus-summary-mode-map [menu-bar summary sort-by-date]
- '("sort-by-date" . gnus-summary-sort-by-date))
- (define-key gnus-summary-mode-map [menu-bar summary sort-by-number]
- '("sort-by-number" . gnus-summary-sort-by-number))
- (define-key gnus-summary-mode-map [menu-bar summary sort-by-subject]
- '("sort-by-subject" . gnus-summary-sort-by-subject))
- (define-key gnus-summary-mode-map [menu-bar summary sort-summary]
- '("sort-summary" . gnus-summary-sort-summary))
- (define-key gnus-summary-mode-map [menu-bar summary toggle-header]
- '("toggle-header" . gnus-summary-toggle-header))
- (define-key gnus-summary-mode-map [menu-bar summary toggle-mime]
- '("toggle-mime" . gnus-summary-toggle-mime))
- (define-key gnus-summary-mode-map [menu-bar summary toggle-threads]
- '("toggle-threads" . gnus-summary-toggle-threads))
- (define-key gnus-summary-mode-map [menu-bar summary toggle-truncation]
- '("toggle-truncation" . gnus-summary-toggle-truncation)))
-
- ;; now bind the menus and keys...
-
- (gnus-set-menus)
-
- (define-key gnus-group-mode-map [mouse-2] 'gnus-group-read-group)
- (define-key gnus-group-mode-map [down-mouse-2] 'mouse-set-point)
- (define-key gnus-summary-mode-map [down-mouse-2] 'mouse-set-point)
- (define-key gnus-summary-mode-map [mouse-2] 'gnus-summary-show-article)
- (define-key gnus-summary-mode-map [down-mouse-3] 'mouse-set-point)
- (define-key gnus-summary-mode-map [mouse-3] 'gnus-summary-mark-as-read-forward)
- (define-key gnus-group-mode-map [down-mouse-3] 'mouse-set-point)
- (define-key gnus-group-mode-map [mouse-3] 'gnus-group-catchup)
-
- ;;; end gnus-mouse.el
-